﻿//-----------------------------------------------------------------------
// <copyright>
// This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
// </copyright>
//----------------------------------------------------------------------- 
using System;

namespace Fulcrum.ControlGenerator
{
    public class TemplatePartDataContext
    {
        public TemplatePartDataContext(ITemplatePartConfiguration templatePartConfig)
        {
            this.Description = templatePartConfig.Description;
            this.Name = templatePartConfig.Name;
            this.IsOptional = templatePartConfig.Optional;
            this.Type = templatePartConfig.Type;
        }

        public string Name
        {
            get;
            private set;
        }

        public string Type
        {
            get;
            private set;
        }

        public string Description
        {
            get;
            private set;
        }

        public bool IsOptional
        {
            get;
            private set;
        }

        public string PartName
        {
            get
            {
                return String.Format("PART_{0}", this.Name);
            }
        }

        public string FieldName
        {
            get
            {
                char[] charString = this.Name.ToCharArray();

                charString[0] = Char.ToLower(charString[0]);

                return new String(charString);
            }
        }
    }
}
